// pages/cat_mse_look/cat_nickname.js
const app = getApp()
var that
Page({
  data: {
    name: null,  //猫咪昵称
    cat_id:"",
  },
  onLoad: function (options) {
    that = this;
    this.setData({ name: options.nickname, cat_id: options.id});
  },

  onReady: function () {
  
  },

  onShow: function () {
  
  },
  NameInput:function(e){
    this.setData({ name: e.detail.value });
  },
  delete_put: function () {
    this.setData({ name: "" });
  },
  nickname_ok: function () {
    var n = that.data.name
    // console.log(n == null || n == undefined || n.length == 0 || n == "" || n == " ");
    if (n == null || n == undefined || n.length == 0 || n == "") {
      wx.showToast({
        title: '内容不能为空',
        image: '../../images/g.png',
        duration: 1000,
        mask: true
      })
    } else {
      app.update_cat_msg("nickname", that.data.name, that.data.cat_id);
      wx.navigateBack({//返回上一级
        delta: 1
      })
    }

  }
})